home *** CD-ROM | disk | FTP | other *** search
- Path: news.sprintlink.net!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Need help reading sockets
- Date: Mon, 25 Mar 1996 11:35:46 -0500
- Organization: Datalytics, Inc
- Message-ID: <3156CB62.2584@datalytics.com>
- References: <4j23rh$bnu@ginger.lei.net>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Daniel Nakamura wrote:
- >
- > I have a problem with reading sockets. I'm currently using the read
- > function to read sockets, then put the information into a buffer. The
- > problem is that I can't read the socket until there is a cariage return.
- > I'd like to read the socket character by character instead of waiting for
- > the charage return. Does anyone know how to do it?
- >
-
- Can't you just query for the number of bytes waiting and read
- only that many? I think your problem is that you're asking for
- more data than is available, so the read call is blocking. You
- can have a buffer to read, say 2K, but ask read for only the
- number of waiting bytes up to 2K. This should eliminate the
- block.
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-